package com.test.day03;

import java.io.File;

/**
 * @program: javaTest
 * @author: luhd
 * @create: 2021-08-01
 */
public class Demo02File {
    public static void main(String[] args) {
        show01();
        show02("c:\\","a.txt");
        show03();
    }
    // 第一种构造方法
    private static void show01(){
        File f1 = new File("D:\\myProject\\javaTest\\a.txt");
        System.out.println(f1); //重写了object类的toString方法
    }
    //第二种构造方法
    private static void show02(String parent, String child){
        File file = new File(parent, child);
        System.out.println(file);
    }
    //第三种构造方法
    private static void show03(){
        File parent = new File("c:\\");
        File file = new File(parent, "hello.java");
        System.out.println(file);
    }
}
